package com.mianshi;

import java.util.Scanner;

public class wangyi1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = n;
        int target = 0;
        while(k != 0){
            int num = k % 10;
            if(num != 0 && n % num == 0){
                target++;
            }
            k /= 10;
        }
        System.out.println(target);
    }
}
